/*
 * An implementation of the Congestion Manager (CM) for Linux.
 * This file contains the CM protocol between sender and receiver.
 */
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/socket.h>
#include <linux/types.h>
#include <linux/in.h>
#include <linux/kernel.h>
#include <net/ip.h>
#include <net/cm.h>
#include <net/cm_proto.h>

inline int skb_discard(struct sk_buff *skb)
{
	kfree_skb(skb);
	return 0;
}

int cm_rcv(struct sk_buff *skb, unsigned short len)
{
	/* struct cmhdr *cmh; */
	u32 peer;
	
	if (skb->pkt_type!=PACKET_HOST)
		return skb_discard(skb);
	
	peer = skb->nh.iph->saddr;
	/* Pull up the IP header. */
	__skb_pull(skb, skb->h.raw - skb->data);
	
	if (len < sizeof(struct cmhdr))
		return skb_discard(skb);
	
	/* Verify checksum */
	/* XXX needs code */
	return 0;
}
